﻿using ReflectionStudio.Core.Events;
using System;
using System.Data;
using System.Windows;
using System.Windows.Data;
using System.ComponentModel;
namespace WPFExcelReport
{
    public partial class TVKMU
    {

        public TVKMU()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            MV = new VABAUFM();
            this.DataContext = MV; 
            InitializeComponent();
        }
        public override void vwMaster_CurrentChanged(object sender, EventArgs e)
        {
            base.vwMaster_CurrentChanged(sender, e);
            if (dwMaster == null)
            {
                ABAUF = "";
            }
            else
            {
                ABAUF = dwMaster["ABAAUFTYP"].ToString() + dwMaster["ABAAUFKRS"].ToString() + dwMaster["ABAAUFLFD"].ToString() + dwMaster["ABAAUFPOS"].ToString();
          
            }
        }

       
        public override void OnVKAUFChg(string _vkauf)
        {
            TBMain.Clear();
            if (VKAUF.Length < 11)
                return; 
            dwData = TBMain.NewRow();
            dwData["ABAMANDANT"] = app.Mandant;
            dwData["ABAVKAUFTYP"] = VKAUF.Substring(0, 1);
            dwData["ABAVKAUFKRS"] = VKAUF.Substring(1, 2);
            dwData["ABAVKAUFLFD"] = VKAUF.Substring(3, 6);
            dwData["ABAVKAUFPOS"] = VKAUF.Substring(9, 3);
            SResult =TMV.QMU18(dwData);
            MergeData(SResult, true); 
        }
        public override void OnEXAUFChg(string vlaue)
        {
            TBMain.Clear();
            if (EXAUF.Length < 11)
                return;
            dwData = TBMain.NewRow();
            dwData["ABAMANDANT"] = app.Mandant;
            dwData["ABAVKAUFTYP"] = EXAUF.Substring(0, 1);
            dwData["ABAVKAUFKRS"] = EXAUF.Substring(1, 2);
            dwData["ABAVKAUFLFD"] = EXAUF.Substring(3, 6);
            dwData["ABAVKAUFPOS"] = EXAUF.Substring(9, 3);
            SResult = TMV.QMU18(dwData);
            MergeData(SResult, true);
            base.OnEXAUFChg(vlaue);
        }

    }
}
